Skip to content

[GSoC] Point Cloud Object Fitting #2584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: 4.x
Choose a base branch
from

Conversation

devanshbatra04
Copy link
Contributor

@devanshbatra04 devanshbatra04 commented Jun 30, 2020

This PR would contain the work done towards the GSoC 2020 project on Point Cloud object fitting.

This is a test to see whether the PR builds. I will continue adding changes.
cc: @mihaibujanca

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under OpenCV (BSD) License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

#include <vector>
#include <utility>
#include "opencv2/viz.hpp"
#define PLANE_MODEL 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enums are a better choice than defines

@mihaibujanca
Copy link

@devanshbatra04 Any update on this, please?


bool getSphereFromPoints(const Vec3f* &points, const std::vector<unsigned> &inliers, Point3d& center, double& radius) {
// assert that size of points is 3.
Mat temp(5,5,CV_32FC1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a 4x4 Mat, with the last column set to 1

(as it is now, it has 10 uninitialized values, wrecking any determinant calculated later)


assert(normals_cld.cols == cloud.cols);

const Point3d* points = cloud.ptr<Point3d>(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this must be Point3f (the point cloud is in float format, not double)


double magnitude_abc = sqrt(ModelCoefficients[0]*ModelCoefficients[0] + ModelCoefficients[1]* ModelCoefficients[1] + ModelCoefficients[2] * ModelCoefficients[2]);

assert (magnitude_abc == 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for sure you want != 0 here

return result;
}

viz::WCylinder SACCylinderModel::WindowWidget () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably, we should outsource any drawing functionality to the samples.

having a dependancy of the library code to the viz module (which again depends on vtk) is some major bummer, this could/should be made optional

break;
}
vector<unsigned> latest_model_inliers = inliers.back();
num_segmented_points += latest_model_inliers.size();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bail out, if num_segmented_points==0 ?

(since the rng is reseeded inside fit_once() it cannot do anything different, if the labels array wasn't changed, leading to an infinite loop)

}

if (model_type == CYLINDER_MODEL) {
assert(this->normals_available == true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, currently, normals are not optional here.

maybe we can add another method for adding a hypothesis based on 3 points (2 points parallel to the axis, just on the outer hull, and a 3rd, somewhat opposite) ?

generating normals from 12 (!) knn neighbours only seems to work nicely for very dense clouds, but not for sparse, synthetic or sfm generated clouds

@mihaibujanca
Copy link

Hi, @devanshbatra04 it's been quite some time without an update. Can you please refactor the code as suggested so we can merge the PR?

@berak
Copy link
Contributor

berak commented Feb 23, 2021

would there be a way to work on this (and still keep the original commits / @devanshbatra04 as author) ?

i think i got some improvements

@WanliZhong
Copy link
Member

would there be a way to work on this (and still keep the original commits / @devanshbatra04 as author) ?

i think i got some improvements

Hi, we notice that you are improving the object detection feature. Our group hopes to complete the feature. What do you think we can do for this feature? Thank you.

@berak
Copy link
Contributor

berak commented Mar 18, 2021

if it is about the gsoc idea,
please apply to the mainling list

@WanliZhong
Copy link
Member

if it is about the gsoc idea,
please apply to the mainling list

We really don't know that this project has been listed as GSoC project again. We will try to apply. Thank you.

@asenyaev
Copy link
Contributor

asenyaev commented Apr 9, 2021

jenkins cn please retry a build

@berak berak mentioned this pull request May 25, 2021
6 tasks
@JoeHowse
Copy link
Contributor

Is this pull request superseded by opencv/opencv#21276 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants